<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组切换综合应用</title>
    <script src="../Vue.js"></script>
</head>
<body>

    <div class="app">
        <button @click="sub" v-show="index>0"><</button>
        <span>{{Data[index]}}</span>
        <button @click="add" v-show="index<Data.length-1">></button>
        <div>现在的索引是{{index}}</div>
    </div>

    <script>
        let app = new Vue({
            el:".app",
            data:{
            	Data:['你好我是1','你好我是2','你好我是3','你好我是4','你好我是5','你好我是6'],
                index:0
            },
            methods:{
                sub:function () {
                    this.index -=1
                },
                add:function () {
                    this.index +=1
                }
            }
        })
    </script>
</body>
</html>